<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

    </style>
</head>
<body>
    <div class="box abc qwe asd" id="cont" abc="123123" title="这是一个title">
        <em>这是切斜的文字</em>
        <span>这是span</span>
        <p>这是p</p>
    </div>
    <img class="img" src="https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png" alt="这是一张图">
    <input type="text" id="txt" value="hello">
</body>
<script>
    var otxt = document.querySelector("#txt")
    var obox = document.querySelector(".box")
    var oimg = document.querySelector(".img")

    console.log(obox.getAttribute("class"))

    // console.log(obox.children)
    // 空格和换行为文本节点
    console.log(obox.childNodes)
    // console.log(obox.firstElementChild)
    // console.log(obox.lastElementChild)
    // console.log(obox.firstChild)
    // console.log(obox.parentNode)
</script>
</html>